import { getEnvMode, isDevMode } from '@/utils/env';
import { Demo, LAYOUT } from '../constant';
import { AppRouteRecordRaw } from '../types';
import demoRoute from './modules/demo';
import levelRoute from './modules/level';
import outerRoute from './modules/outer';

let asyncRoute: AppRouteRecordRaw[] = [
	{
		path: 'home',
		name: 'Home',
		component: () => import('@/views/home/Home.vue'),
		meta: {
			title: '首页',
			icon: 'bx:bx-home',
		},
	},
	{
		path: 'siteList',
		name: 'SiteList',
		component: Demo,
		meta: {
			title: '站点清单',
			icon: 'mdi:hydrogen-station',
		},
	},
	{
		path: 'docs',
		name: 'Docs',
		component: Demo,
		meta: {
			title: '文档目录管理',
			icon: 'ep:document',
		},
	},
	{
		path: 'equipments',
		name: 'Equipments',
		component: Demo,
		meta: {
			title: '重点设备监测',
			icon: 'bx:bx-home',
		},
	},
	{
		path: 'monitors',
		name: 'Monitors',
		component: Demo,
		meta: {
			title: '视频监控',
			icon: 'bx:bx-home',
		},
	},
	{
		path: 'inspection',
		name: 'Inspection',
		component: Demo,
		meta: {
			title: '现场检查管理',
			icon: 'bx:bx-home',
		},
	},
	{
		path: 'report',
		name: 'Report',
		component: LAYOUT,
		redirect: '/report/hydrogenSales',
		meta: {
			title: '报表管理',
			icon: 'bx:bx-home',
		},
		children: [
			{
				path: 'hydrogenSales',
				name: 'ReportHydrogenSales',
				component: Demo,
				meta: {
					title: '氢气销售情况',
				},
			},
		],
	},
	{
		path: 'emergency',
		name: 'Emergency',
		component: LAYOUT,
		redirect: '/emergency/person',
		meta: {
			title: '应急基础信息管理',
			icon: 'bx:bx-home',
		},
		children: [
			{
				path: 'person',
				name: 'EmergencyPerson',
				component: Demo,
				meta: {
					title: '应急人员管理',
				},
			},
			{
				path: 'material',
				name: 'EmergencyMaterial',
				component: Demo,
				meta: {
					title: '应急物资管理',
				},
			},
			{
				path: 'dangerous',
				name: 'EmergencyDangerous',
				component: Demo,
				meta: {
					title: '危险品管理',
				},
			},
			{
				path: 'fire',
				name: 'EmergencyFire',
				component: Demo,
				meta: {
					title: '消防安全基础信息',
				},
			},
		],
	},
	{
		path: 'afterwards',
		name: 'Afterwards',
		component: LAYOUT,
		redirect: '/afterwards/statistics',
		meta: {
			title: '应急事后分析',
			icon: 'bx:bx-home',
		},
		children: [
			{
				path: 'statistics',
				name: 'AfterwardsStatistics',
				component: Demo,
				meta: {
					title: '事故统计分析',
				},
			},
		],
	},
];

if (isDevMode() || getEnvMode() == 'test') {
	asyncRoute = [...asyncRoute, ...levelRoute, ...outerRoute, ...demoRoute];
}

export default asyncRoute;
